Zend: Fix iterator relocation at the current element during rehash - #23607
Open
LamentXU123 wants to merge 2 commits into
Open
Zend: Fix iterator relocation at the current element during rehash#23607LamentXU123 wants to merge 2 commits into
LamentXU123 wants to merge 2 commits into
Conversation
devnexen
reviewed
Sep 7, 2026
| zend_hash_iterators_update(ht, iter_pos, j); | ||
| iter_pos = zend_hash_iterators_lower_pos(ht, iter_pos + 1); | ||
| } while (iter_pos < i); | ||
| } while (iter_pos <= i); |
Member
There was a problem hiding this comment.
nit: while at it, you can also fix zend_array_dup_elements()
Member
Author
There was a problem hiding this comment.
Right. and I think this is the similar fix to the existing one so we don't need to add more NEWS entry.
When one iterator points at a hole and another at the next live bucket, the relocation loop must include the iterator at that bucket's original position. Otherwise it is moved to the following bucket's destination, causing a nested by-reference foreach to skip an element. Add regression coverage for packed-to-hash conversion and compaction of a full mixed table.
LamentXU123
force-pushed
the
codex/fix-rehash-iterator-position
branch
from
September 7, 2026 16:28
cb88dd2 to
2e62b97
Compare
Member
Author
|
I am testing my new agent workflow to help me branching written PR to remote and obviously it glitched so this is unintentionally closed and reopened. Sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found when I am implementing #23585
Return
But I expect: